package org.ibase4j.web.weixin;

import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.ibase4j.model.weixin.WeixinConfig;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import top.ibase4j.core.base.BaseController;
import top.ibase4j.core.support.context.ApplicationContextHolder;

import org.ibase4j.service.sys.BarcodeProcess;
import org.ibase4j.service.weixin.WeixinConfigService;

/**
 * <p>
 * 微信账号主体配置  前端控制器
 * </p>
 *
 * @author zoyee
 * @since 2018-08-06
 */
@Controller
@RequestMapping("/weixinConfig")
@Api(value = "微信账号主体配置接口", description = "微信账号主体配置接口")
public class WeixinConfigController extends BaseController<WeixinConfig, WeixinConfigService> {

	@RequiresPermissions("weixinConfig.read")
	@PutMapping(value = "/read/list")
	@ApiOperation(value = "查询微信账号主体配置")
	public Object query(ModelMap modelMap, @RequestBody Map<String, Object> param) {
		BarcodeProcess process = (BarcodeProcess)ApplicationContextHolder.getBean("barcodeSceneServiceImpl");
		process.execute("");
		return super.query(modelMap, param);
	}

	@RequiresPermissions("weixinConfig.read")
	@PutMapping(value = "/read/detail")
	@ApiOperation(value = "微信账号主体配置详情")
	public Object get(ModelMap modelMap, @RequestBody WeixinConfig param) {
		return super.get(modelMap, param);
	}

	@PostMapping(value = "/write/save")
	@RequiresPermissions("weixinConfig.update")
	@ApiOperation(value = "修改微信账号主体配置")
	public Object update(ModelMap modelMap, @RequestBody WeixinConfig param) {
		return super.update(modelMap, param);
	}

	@DeleteMapping(value = "/delete")
	@RequiresPermissions("weixinConfig.delete")
	@ApiOperation(value = "(逻辑)删除微信账号主体配置")
	public Object del(ModelMap modelMap, HttpServletRequest request, @RequestBody WeixinConfig param) {
		return super.del(modelMap, request, param);
	}
}